﻿using DFGK_WMS.Model.DTO;
using DFGK_WMS.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK_WMS.IRepository
{
    /// <summary>
    /// 入库
    /// </summary>
    public interface ITReceivingOrderDetailRepository: IBaseRepository<TReceivingOrderDetail>
    {
        #region 添加入库单弃用
        ///// <summary>
        ///// 添加入库单管理
        ///// </summary>
        ///// <param name="m"></param>
        ///// <returns></returns>
        //bool AddTReceivingOrderDetail(TReceivingOrderDetail m,out string message);
        #endregion

        #region 修改入库单弃用
        ///// <summary>
        ///// 修改入库单
        ///// </summary>
        ///// <param name="m"></param>
        ///// <returns></returns>
        //bool UpdTReceivingOrderDetail(TReceivingOrderDetail m,out string message);
        #endregion

        /// <summary>
        /// 文件下载
        /// </summary>
        /// <returns></returns>
        bool FileDownload(string SourceFile, string DestinationFolder);


        /// <summary>
        /// 往sqlite中写入数据
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool AddSqliteDetail(GroupReceivingOrderDto m,out string message);

        /// <summary>
        /// 添加入库单
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool AddTReceivingOrderDetail(GroupReceivingOrderDto m, out string message);

        /// <summary>
        /// 在sqlite中获取数据
        /// </summary>
        /// <returns></returns>
        List<GroupReceivingOrderDto> GetReceivingOrderDtos();

        /// <summary>
        /// 提交按钮
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool SubmitReceiving(out string message); 


        /// <summary>
        /// 删除入库单
        /// </summary>
        /// <param name="ordersn"></param>
        /// <returns></returns>
        bool DelTReceivingOrderDetail(string ordersn);

        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool UpdTReceivingOrderDetaState(ReceivingOrderDetailDto m);

        /// <summary>
        /// 查看
        /// </summary>
        /// <param name="rid"></param>
        /// <returns></returns>
        TReceivingOrderDetail GetTReceivingOrderDetailById(int rid);

        
        GroupReceivingOrderDto GetGroupReceivingOrderDtoByOrdersn(string ordersn);
        
        /// <summary>
        /// 修改入库单
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool UpdTReceivingOrderDetail(GroupReceivingOrderDto m, out string message);

        /// <summary>
        /// 显示入库单
        /// </summary>
        /// <param name="billType"></param>
        /// <param name="status"></param>
        /// <param name="warehouseid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<TReceivingOrderDetail> GetReceivingOrderDetailList(string orderSn, int billType,int status,int warehouseid,int pageIndex,int pageSize,out int totalCount);
        /// <summary>
        /// 导出入库单
        /// </summary>
        /// <returns></returns>
        List<TReceivingOrderDetail> GetTReceivingOrderDetailExcel();
        /// <summary>
        /// 执行入库作业
        /// </summary>
        /// <returns></returns>
        bool ExecReceving(TReceivingOrderDetail orderDetail , out string  errMsg);

        /// <summary>
        /// 显示入库单列表
        /// </summary>
        /// <param name="orderSn"></param>
        /// <param name="billType"></param>
        /// <param name="status"></param>
        /// <param name="warehouseid"></param>
        /// <param name="rolecode"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<GroupReceivingOrderDto> GetGroupReceivingOrderList(string? StartTime,string? EndTime, int? billType, int ?status,string rolecode, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 打印条码
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <returns></returns>
        List<TReceivingPrint> PrintReceiving(int OrderId);

        /// <summary>
        /// 判断库中是否有此物料
        /// </summary>
        /// <param name="OrderSn"></param>
        /// <returns></returns>
        bool DoesItExistMaterial(string OrderSn,string ReceivingPoint,string Position, out string mes);

        /// <summary>
        /// 获取计量单位换算表
        /// </summary>
        /// <returns></returns>
        UnitOfMeasurementRules GetUnitRulesList(int? UnitId);


        TMateialCategoryAddNumber GetCategoryNumByCode (int categoryId,out string message);

        bool IsInventoryWarn(List<TInventory> inventories);

        /// <summary>
        /// 获取采购员角色的相关人员
        /// </summary>
        /// <returns></returns>
        List<TUser> GetPurchaseRole();

        /// <summary>
        /// 根据仓位及物料编码获取数量
        /// </summary>
        /// <param name="cellCode"></param>
        /// <param name="materialCode"></param>
        /// <returns></returns>
        decimal? GetMsgByCellAndCode(string cellCode, string materialCode);
    }
}
